<?php
use yii\widgets\ActiveForm;
use kartik\file\FileInput;
use yii\helpers\Html;
use yii\bootstrap\Modal;
use yii\helpers\Url;
use backend\models\Category;
use kartik\select2\Select2;
use yii\web\JsExpression;
use yii\helpers\ArrayHelper;
?>
<style type="text/css">
	.data-form label{
		color: white;
	}

	.data-form h1,h2,h3{
		color: white;
	}
</style>

<?php $form = ActiveForm::begin([
	'options' => ['enctype'=>'multipart/form-data'],
	]); ?>
	<div class="row data-form" style="width: 80%; margin: 0px auto; padding-top: 20px; padding-bottom: 20px;background: gray;">
		<div class="col-lg-12">
			<h3 style="text-align:center;"><?=$pageTitle?></h3>
<!--			<hr/>-->
			<div>

				<!-- Nav tabs -->
				<ul class="nav nav-tabs" role="tablist">
					<li role="presentation" class="active"><a href="#base" aria-controls="base" role="tab" data-toggle="tab">基本信息</a></li>
				</ul>

				<!-- Tab panes -->
				<div class="tab-content">
					<div role="tabpanel" class="tab-pane active" id="base">
						<?=$form->field($goods, 'name')->textInput()?>
                        <?=$form->field($goods, 'price')->textInput()?>
                        <?=$form->field($goods, 'unit')->dropDownList(Yii::$app->params['unit'])?>
						<?=$form->field($goods, 'cid')->dropDownList(Category::tree())?>
						<?=$form->field($goods, 'article_id')->widget(Select2::classname(), [
							'initValueText' => $articleElder,
							'options' => [
							'placeholder' => '#搜索文章#',
							'id' => 'article',
							],
							'pluginOptions' => [
							'language' => [
							'errorLoading' => new JsExpression("function () { return 'Waiting...'; }"),
							],

							'ajax' => [
							'url' => Url::toRoute(['article/search']),
							'dataType' => 'json',
							'data' => new JsExpression('function(params) { return {q:params.term}; }'),
							'quietMillis' => 10000,
							],

							'escapeMarkup' => new JsExpression('function (markup) { return markup; }'),
							'templateResult' => new JsExpression('function(res) { return res.text; }'),
							'templateSelection' => new JsExpression('function (res) { return res.text; }'),
							],
							]);
						?>
                        <?=$form->field($goods, 'is_hot')->dropDownList(Yii::$app->params['is_hot'])?>
                        <?=$form->field($goods, 'is_advise')->dropDownList(Yii::$app->params['is_advise'])?>
                        <?=$form->field($goods, 'format')->textarea(['rows' => 8])?>
                        <?=$form->field($goods, 'image_id')->widget(\noam148\imagemanager\components\ImageManagerInputWidget::className(), [
								'aspectRatio' => (18/9),
								'showPreview' => true,
								'showDeletePickedImageConfirm' => false,
								]);
                        ?>
                    </div>
                </div>

            </div>
            <?=Html::submitButton('提交', ['class'=>'btn btn-primary btn-block','name' =>'submit-button'])?>
        </div>
    </div>
<?php ActiveForm::end(); ?>

